Skip to content

check issimpleenoughtype for PartialStruct during issimplertype#61130

Merged
vtjnash merged 5 commits intoJuliaLang:masterfrom
adienes:fast_path_tmerge_partialstruct
Mar 31, 2026
Merged

check issimpleenoughtype for PartialStruct during issimplertype#61130
vtjnash merged 5 commits intoJuliaLang:masterfrom
adienes:fast_path_tmerge_partialstruct

Conversation

@adienes
Copy link
Copy Markdown
Member

@adienes adienes commented Feb 23, 2026

fixes #60715

tmerge_types_slow would check issimpleenoughtype(u) after the PartialStructs were stripped from the types, but that path wasn't getting hit as it would early return via tmerge_fast_path

Claude assisted the analysis but the proposed fix is mine

@adienes adienes added bugfix This change fixes an existing bug compiler:inference Type inference labels Feb 23, 2026
@vtjnash
Copy link
Copy Markdown
Member

vtjnash commented Feb 23, 2026

This looks inaccurate of a fix. The tmerge_fast_path code checks issimplertype which should already be a sufficient and superior fix to this. Any idea what input is there? We should add a unit test for that, and not just this integration test

@adienes
Copy link
Copy Markdown
Member Author

adienes commented Feb 23, 2026

let T(n) = Tuple{Int, Union{Int, Tuple{Int, Union{...}}}} to a nesting depth of 2n (so each of Tuple, Union occurs n times)

then IIUC typea = PartialStruct(T(n), [Const(0), Union{Int, T(n-1)}]) and typeb = PartialStruct(T(n+1), [Const(0), Union{Int, T(n)}])

@adienes adienes changed the title enforce issimpleenoughtype in fast path for tmerge for PartialStruct check issimpleenoughtype for PartialStruct during issimplertype Feb 23, 2026
adienes and others added 2 commits February 23, 2026 15:59
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
@KristofferC KristofferC added backport 1.12 Change should be backported to release-1.12 backport 1.13 Change should be backported to release-1.13 labels Feb 24, 2026
@KristofferC KristofferC mentioned this pull request Feb 25, 2026
37 tasks
@adienes adienes requested a review from vtjnash February 25, 2026 14:16
@KristofferC KristofferC mentioned this pull request Mar 3, 2026
56 tasks
@adienes
Copy link
Copy Markdown
Member Author

adienes commented Mar 12, 2026

look ok now?

@KristofferC KristofferC mentioned this pull request Mar 13, 2026
27 tasks
@vtjnash vtjnash merged commit e820849 into JuliaLang:master Mar 31, 2026
8 checks passed
@adienes adienes deleted the fast_path_tmerge_partialstruct branch March 31, 2026 02:31
aviatesk pushed a commit that referenced this pull request Mar 31, 2026
…61130)

fixes #60715

`tmerge_types_slow` would check `issimpleenoughtype(u)` after the
`PartialStruct`s were stripped from the types, but that path wasn't
getting hit as it would early return via `tmerge_fast_path`

Claude assisted the analysis but the proposed fix is mine
@aviatesk aviatesk removed the backport 1.13 Change should be backported to release-1.13 label Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 1.12 Change should be backported to release-1.12 bugfix This change fixes an existing bug compiler:inference Type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type inference hangs on recursive varargs function returning nested tuples

4 participants